<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<!DOCTYPE html>
<html lang=ko>
<head>
<meta charset=UTF-8 />
<meta name=viewport content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1" />
<title>여기에 제목 입력</title>
<link rel="shortcut icon" href=assets/ico/favicon.png />
<link rel=apple-touch-icon-precomposed href=assets/ico/apple-touch-icon-57-precomposed.png />
<link rel=apple-touch-icon-precomposed sizes=72x72 href=assets/ico/apple-touch-icon-72-precomposed.png />
<link rel=apple-touch-icon-precomposed sizes=114x114 href=assets/ico/apple-touch-icon-114-precomposed.png />
<link rel=apple-touch-icon-precomposed sizes=144x144 href=assets/ico/apple-touch-icon-144-precomposed.png />
<link rel=stylesheet type=text/css href=assets/font-awesome-4.0.3/css/font-awesome.min.css />
<link rel=stylesheet type=text/css href=assets/css/bootstrap.min.css />
<link rel=stylesheet type=text/css href=assets/css/nanumfont.css />
<!--[if lt IE 9]>
<script type=text/javascript src=assets/js/html5shiv.js></script>
<script type=text/javascript src=assets/js/respond.min.js></script>
<![endif]-->
<!--[if gt IE 9]>
<link rel=stylesheet type=text/css href=assets/css/ie10.css />
<script type=text/javascript src=assets/js/ie10.js></script>
<![endif]-->
<title>metro_timesheet</title>
<style type=text/css>body{padding-top:60px}ul,li{margin:0;padding:0;list-style:none}#list-header2{position:absolute;top:100px}.sub-header-box{background:#000;display:none}body.modal-open,.modal-open .navbar-fixed-top,.modal-open .navbar-fixed-bottom{margin-right:0!important}.metro-list-center{display:inline-block;border:1px solid #000;height:75px;width:75px;border-radius:50%}.center_text{text-align:center}table>thead>tr>th:FIRST-CHILD{text-align:right}table>tbody>tr>td:FIRST-CHILD{text-align:right}nav.navbar{line-height:50px;background-color:#ff8a00;border-bottom:1px solid #4f2b00}.nav_content{position:relative;max-width:737px;margin:auto;padding-left:5px;padding-right:5px}.nav_menu_btn{width:50px;position:absolute;top:0;left:5px;font-size:25px}.page_title{font-size:20px;color:#fff}.back_btn{color:#fff}.back_btn:hover{color:#333}a:hover{text-decoration:none}</style>
</head>
<body>
<nav class="navbar navbar-fixed-top" role=navigation>
<div class="nav_content text-center">
<div class="nav_menu_btn pull-left text-center">
<a class=back_btn onclick=history.back()><i class="fa fa-arrow-left"></i></a>
</div>
<span class=page_title><strong>경로선택</strong></span>
</div>
</nav>
<div class=content>
<div id=metro0>
<span class="metro-list metro0"> </span>
</div>
<div id=metro1>
<span class="metro-list metro1"> </span>
</div>
<div id=metro2>
<span class="metro-list metro2"> </span>
</div>
<div id=metro3>
<span class="metro-list metro3"> </span>
</div>
</div>
<table class="table table-striped"></table>
<script src=assets/js/jquery.js></script>
<script src=assets/js/bootstrap.min.js></script>
<script type=text/javascript>$(function(){$("strong").html(sessionStorage.stn_nm+"역 시간표");var e=new Date();var a=1;if(e.getDay()==0){a=3}else{if(e.getDay()==6){a=2}}var c=new Array();c=sessionStorage.stn_cd.split(",");for(var d=0;d<c.length/2;d++){for(var b=1;b<=2;b++){wheremetro(c[d*2],a,b,d)}}$(document).on("click",".metro-list-left",function(){timesheet(c[$(this).attr("leng")*2],a,$(this).attr("io"));return false});$(document).on("click",".metro-list-right",function(){timesheet(c[$(this).attr("leng")*2],a,$(this).attr("io"));return false})});function wheremetro(c,b,a,d){var f="";var e="http://openapi.seoul.go.kr:8088/6372696d77617832303631/json/SearchArrivalInfoByIDService/1/5/"+c+"/"+a+"/"+b+"/";$.ajax({url:e,dataType:"jsonp",timeout:30000,cache:false,success:function(h){var j=new Array();j=sessionStorage.stn_cd.split(",");var g=h.SearchArrivalInfoByIDService.row[0].LEFTTIME;var i=new Date();if((Number(g.substring(0,2))-i.getHours())*60+(Number(g.substring(3,5))-i.getMinutes())==0){if(a==1){f+='<div class="metro-list-left btn btn-default" io="'+a+'" leng="'+d+'">';f+="현재 역 도착";f+="<br />";f+='<i class="fa fa-arrow-left"></i>';f+="<br />";f+=h.SearchArrivalInfoByIDService.row[0].SUBWAYNAME+"행";f+="</div>"}else{if(a==2){f+="<div>";f+='<span class="metro-list-center">';f+='<div class="center_text">';f+="<br />";f+=j[d*2+1]+"<br />";f+="</div>";f+="</span>";f+="</div>";f+='<div class="metro-list-right btn btn-default" io="'+a+'" leng="'+d+'">';f+="현재 역 도착";f+="<br />";f+='<i class="fa fa-arrow-right"></i>';f+="<br />";f+=h.SearchArrivalInfoByIDService.row[0].SUBWAYNAME+"행";f+="</div>"}}}else{if((Number(g.substring(0,2))-i.getHours())*60+(Number(g.substring(3,5))-i.getMinutes())<60){if(a==1){f+='<div class="metro-list-left btn btn-default" io="'+a+'" leng="'+d+'">';f+=(Number(g.substring(0,2))-i.getHours())*60+(Number(g.substring(3,5))-i.getMinutes())+"분 후 도착";f+="<br />";f+='<i class="fa fa-arrow-left"></i>';f+="<br />";f+=h.SearchArrivalInfoByIDService.row[0].SUBWAYNAME+"행";f+="</div>"}else{if(a==2){f+="<div>";f+='<span class="metro-list-center">';f+='<div class="center_text">';f+="<br />";f+=j[d*2+1]+"<br />";f+="</div>";f+="</span>";f+="</div>";f+='<div class="metro-list-right btn btn-default" io="'+a+'" leng="'+d+'">';f+=(Number(g.substring(0,2))-i.getHours())*60+(Number(g.substring(3,5))-i.getMinutes())+"분 후 도착";f+="<br />";f+='<i class="fa fa-arrow-right"></i>';f+="<br />";f+=h.SearchArrivalInfoByIDService.row[0].SUBWAYNAME+"행";f+="</div>"}}}else{if(a==1){f+='<div class="metro-list-left btn btn-default" io="'+a+'" leng="'+d+'">';f+="도착 정보가 없습니다.";f+="<br />";f+='<i class="fa fa-arrow-left"></i>';f+="<br />";f+=h.SearchArrivalInfoByIDService.row[0].SUBWAYNAME+"행";f+="</div>"}else{if(a==2){f+="<div>";f+='<span class="metro-list-center">';f+='<div class="center_text">';f+="<br />";f+=j[d*2+1]+"<br />";f+="</div>";f+="</span>";f+="</div>";f+='<div class="metro-list-right btn btn-default" io="'+a+'" leng="'+d+'">';f+="도착 정보가 없습니다.";f+="<br />";f+='<i class="fa fa-arrow-right"></i>';f+="<br />";f+=h.SearchArrivalInfoByIDService.row[0].SUBWAYNAME+"행";f+="</div>"}}}}$(".metro"+d).append(f)},error:function(i,g,h){}})}function timesheet(g,y,n){var i="";i+="<thead><tr>";i+="<th>시</th>";i+="<th>분</th>";i+="</tr></thead><tbody>";var m="<tr><td>5</td><td>";var l="<tr><td>6</td><td>";var k="<tr><td>7</td><td>";var j="<tr><td>8</td><td>";var h="<tr><td>9</td><td>";var x="<tr><td>10</td><td>";var w="<tr><td>11</td><td>";var v="<tr><td>12</td><td>";var u="<tr><td>13</td><td>";var t="<tr><td>14</td><td>";var s="<tr><td>15</td><td>";var r="<tr><td>16</td><td>";var q="<tr><td>17</td><td>";var p="<tr><td>18</td><td>";var o="<tr><td>19</td><td>";var f="<tr><td>20</td><td>";var e="<tr><td>21</td><td>";var d="<tr><td>22</td><td>";var c="<tr><td>23</td><td>";var b="<tr><td>24</td><td>";var a="ajax/json/"+g+"_"+y+"_"+n+".json";$.ajax({url:a,dataType:"json",timeout:30000,cache:false,success:function(B){var z=0;for(var A=0;A<B.length;A++){if(Number(B[A].ARRIVETIME.substring(0,2))==0||Number(B[A].ARRIVETIME.substring(0,2))>24){continue}if(A>0&&Number(B[A].ARRIVETIME.substring(0,2))<Number(B[A-1].ARRIVETIME.substring(0,2))){continue}if(Number(B[A].ARRIVETIME.substring(0,2))==24){z=1}if(z==1&&Number(B[A].ARRIVETIME.substring(0,2))<24){continue}if(Number(B[A].ARRIVETIME.substring(0,2))==5){m+=B[A].ARRIVETIME.substring(3,5);m+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==6){l+=B[A].ARRIVETIME.substring(3,5);l+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==7){k+=B[A].ARRIVETIME.substring(3,5);k+=" "}else{if(B[A].ARRIVETIME.substring(0,2)=="08"){j+=B[A].ARRIVETIME.substring(3,5);j+=" "}else{if(B[A].ARRIVETIME.substring(0,2)=="09"){h+=B[A].ARRIVETIME.substring(3,5);h+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==10){x+=B[A].ARRIVETIME.substring(3,5);x+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==11){w+=B[A].ARRIVETIME.substring(3,5);w+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==12){v+=B[A].ARRIVETIME.substring(3,5);v+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==13){u+=B[A].ARRIVETIME.substring(3,5);u+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==14){t+=B[A].ARRIVETIME.substring(3,5);t+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==15){s+=B[A].ARRIVETIME.substring(3,5);s+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==16){r+=B[A].ARRIVETIME.substring(3,5);r+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==17){q+=B[A].ARRIVETIME.substring(3,5);q+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==18){p+=B[A].ARRIVETIME.substring(3,5);p+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==19){o+=B[A].ARRIVETIME.substring(3,5);o+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==20){f+=B[A].ARRIVETIME.substring(3,5);f+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==21){e+=B[A].ARRIVETIME.substring(3,5);e+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==22){d+=B[A].ARRIVETIME.substring(3,5);d+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==23){c+=B[A].ARRIVETIME.substring(3,5);c+=" "}else{if(Number(B[A].ARRIVETIME.substring(0,2))==24){b+=B[A].ARRIVETIME.substring(3,5);b+=" "}}}}}}}}}}}}}}}}}}}}}m+="</td></tr>";l+="</td></tr>";k+="</td></tr>";j+="</td></tr>";h+="</td></tr>";x+="</td></tr>";w+="</td></tr>";v+="</td></tr>";u+="</td></tr>";t+="</td></tr>";s+="</td></tr>";r+="</td></tr>";q+="</td></tr>";p+="</td></tr>";o+="</td></tr>";f+="</td></tr>";e+="</td></tr>";d+="</td></tr>";c+="</td></tr>";b+="</td></tr>";i+=m+l+k+j+h+x+w+v+u+t+s+r+q+p+o+f+e+d+c+b;i+="</tbody>";$(".table").html(i)},error:function(B,z,A){}})};</script>
</body>
</html>